package com.xros.demo.gamedataserver.config;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import sun.security.provider.PolicyParser;

/**
 * @Author: mzp
 * @Description: netty的配置文件
 * @Date: 2024/3/26 14:08
 * @Version: 1.0
 */
@Configuration
public class NettyConfig {


    //region （描述： boss 与 worker EventLoopGroup ）

    /**
     * BOSS处理客户端连接
     */
    @Bean(name = "bossGroup", destroyMethod = "shutdownGracefully")
    public NioEventLoopGroup bossGroup() {
        return new NioEventLoopGroup(1);
    }

    /**
     * Worker处理读写
     */
    @Bean(name = "workerGroup", destroyMethod = "shutdownGracefully")
    public NioEventLoopGroup workerGroup() {
        return new NioEventLoopGroup();
    }


    //endregion


    @Bean
    public ServerBootstrap serverBootstrap() {
        return new ServerBootstrap();

    }


}
